import requests
from concurrent.futures import ThreadPoolExecutor

# 接口 URL 模板
url_template = "http://106.52.201.90:7001/api/ccSmart/syncDimensionByTrackSpanId/invoke?force=true&spanId={}"

# 不同的 spanId 列表
span_ids = [
"xecopfnaeemm8",
"xeern07ihsu0w",
"xerlfbog364n4",
"xem796t1kefwg",
"xe4kc37gaeozk",
"xet513d1m4f7k",
"xeuq4dw5vkvls",
"xenq9jrgoiha8",
"xeapcbh7yv37k",
"xe526d8uxx81s",
"xeq9jvj91ge0w",
"xequylzeg311c",
"xei1e1o70mo74",
"xex7bs3bq2ry8",
"xersk8hne4f7k",
"xeb53nyc6hiww",
"xesqr9qd5m2o0",
"xefygh3slzcow",
"xexck7bg14k5c",
"xetz29gz2juo0",
"xex58uiqgldkw",
"xe5hxpprnvocg",
"xekusbxiu2v40",
"xev7ynxj54zy8",
"xel0fpx1zshs0",
"xeszdpdwece0w",
"xeflo6bdnuku8",
"xeschg3iitfy8",
"xevio15k8z5s0",
"xevtdedlfcpog",
"xewqz0vx2s8hs",
"xe4nwjm5igwsg",
"xeuizh2x6om4g",
"xet8ljrs35iio",
"xeifnvb4cs7b4",
"xexd04ast12io",
"xeelzm88f7wn4",
"xea3xl18gjhmo",
"xeugwji2wketc",
"xetu0a7p122v4",
"xeiqd8j1us2yo",
"xex06v9v4hwqo",
"xedmb25fo55og",
"xevpsxz0zjncw",
"xen4utbdmueps",
"xemhyk1faqha8",
"xefzxzxws2kg0",
"xepyuib2xt6o0",
"xex8taxndv11c",
"xeda463bfndog",
"xetfqglaf4sg0",
"xepm27ijwcef4",
"xeaueaq5gd8g0",
"xes5cja5vmdc0",
"xewwmev7zby0w",
"xezftnuu809hc",
"xedpvik0ledc0",
"xefst34dw385c",
"xev9g6rmerj7k",
"xe4pe2g94khz4",
"xeumjxhb3q2v4",
"xevk5jzw98wlc",
"xesooc5s14gzk",
"xexcgdi3pg7pc",
"xenai7ahqo2dc",
"xeqgosci7txxc",
"xehu94uqck2yo",
"xe40evlcriwhs",
"xetxkqmkwv94w",
"xeta32m7cs4xs",
"xeuv6d5f0lyww",
"xe4d76e6z0dmo",
"xeu8a3us6xla8",
"xerzp5b8zi5mo",
"xeb8o4cw9ryf4",
"xew42rln36eww",
"xe5gg6vl7dt6o",
"xepexap832pds",
"xeg72wrdb6xvk",
"xewphi1w8k5c0",
"xeo4jde9nbcow",
"xeppmnxand340",
"xeb1j7jdqa3uo",
"xeopy3u8o581s",
"xep0nh2d6crgg",
"xes6u24fxyygw",
"xe4syiwfezri8",
"xe5ed9b9iieio",
"xewb7of0zbx8g",
"xee2ntcqs2p6o",
"xe4i95mv5we0w",
"xecmmi2dwdo8w",

]

# 请求头
headers = {
    'User-Agent': 'Apifox/1.0.0 (https://apifox.com)'
}

# 定义请求函数
def call_api(span_id):
    url = url_template.format(span_id)
    try:
        requests.get(url, headers=headers, timeout=1)  # 设置 timeout 避免阻塞
        print(f"Request sent with spanId={span_id}")
    except Exception as e:
        print(f"Error with spanId={span_id}: {e}")

# 使用线程池异步调用
with ThreadPoolExecutor(max_workers=10) as executor:  # 最多 10 个并发
    executor.map(call_api, span_ids)

print("All requests sent asynchronously!")